package com.example.unisys.service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.unisys.dao.MainCourseMapper;
import com.example.unisys.entity.MainCourse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class MainCourseService extends ServiceImpl<MainCourseMapper,MainCourse> {



   public int insert(MainCourse maincourse  ){
        return baseMapper.insertSelective(maincourse);
    }

   public int insertSelective(MainCourse maincourse){
        return baseMapper.insertSelective(maincourse);
    }

   public int update(MainCourse maincourse){
        return baseMapper.update(maincourse);
    }

   public List<MainCourse> getBySchool(String main_school){
        return baseMapper.getBySchool(main_school);
    }

   public MainCourse getById(String main_school,String course_id){
        return baseMapper.getById(main_school,course_id);
    }

    public Integer getAllCourse(String main_school){
       return baseMapper.getAllCourse(main_school);
    }

    public List<MainCourse> getMainValidCourse(String main_school,int start,int pagesize){
       return baseMapper.getMainValidCourse(main_school,start,pagesize);
    }

    public Integer getMainValidCourseSum(String main_school){
       return baseMapper.getMainValidCourseSum(main_school);
    }

    public List<MainCourse> getByMainSchool(String main_school,int start,int pagesize){
       return baseMapper.getByMainSchool(main_school,start,pagesize);
    }

    public Integer delete(String course_id, String main_school){
       return baseMapper.delete(course_id,main_school);
    }

}
